package Test1;

public class Test {
    public static void main(String[] args) {
        Bird[]birds =new Bird[5];
        Penguin penguin =new Penguin();
        Sparrow sparrow = new Sparrow();
        Eagle eagle = new Eagle();
        birds[0] = penguin;
        birds[1] = penguin;
        birds[2] = sparrow;
        birds[3] = sparrow;
        birds[4] = eagle;

        for (int i = 0; i < birds.length; i++) {

            if (birds[i]==penguin){
                penguin.swimming();
            }else if (birds[i]==sparrow){
                sparrow.flying();
            }else {
                eagle.flying();
            }
        }
    }
}
